package com.mop.service;

import com.mop.mapper.SignInMapper;
import com.mop.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import java.util.Date;

@Service
public class SignInServiceImpl implements SignInService{
    @Autowired
    private SignInMapper signInMapper;

    @Override
    public void addSignIn(User user) {
        Date data=new Date();
        String password=user.getPassword();
        String md5Digest= DigestUtils.md5DigestAsHex(password.getBytes());
        user.setPassword(md5Digest).setStatus(true).setCreated(data).setUpdated(data);
        signInMapper.addSignIn(user);
    }
}
